-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save calendar name reference in loaded calendar #82
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks for submitting a PR.
This sounds like a good idea, I've left a couple of suggestions!
lib/business/calendar.rb
Outdated
working_days: data["working_days"], | ||
extra_working_dates: data["extra_working_dates"], | ||
calendar_name, | ||
**data.slice("holidays", "working_days", "extra_working_days"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should convert initialize
to take kwargs here and keep the explicit definition of the arguments.
**data.slice("holidays", "working_days", "extra_working_days"), | |
name: calendar_name, |
lib/business/calendar.rb
Outdated
|
||
def initialize(config) | ||
def initialize(name, config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, let's convert this to have explicit nil kwargs, something along the lines of:
def initialize(name, config) | |
def initialize(name:, extra_working_dates: nil, working_days: nil, holidays: nil) |
@JoeSouthan Thanks for the suggestion! That is better. I've updated the PR to reflect those nil kwargs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for this!
Released as v2.2.0 |
We use Business::Calendar at Modern Treasury.
There are a few use cases where we point a bank interface on a calendar based on several config values. It's helpful for us to sometimes print out the loaded configuration, including the calendar reference. I thought it would be helpful to have a
.name
reference on the calendar instance.